<?php

namespace app\model;

//use support\Model;
use support\Db;
use Illuminate\Database\Eloquent\Model;

class WaAdminRoles
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'wa_admin_roles';

    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $primaryKey = 'id';

    /**
     * Indicates if the model should be timestamped.
     *
     * @var bool
     */
    public $timestamps = false;

    public static function all()
    {
        $pageNum = 10;
        $list = Db::table('wa_admin_roles')
            ->select('*')
            ->paginate($pageNum);

        return json_encode($list);
    }

    public static function find($condition = [])
    {
        $res = Db::table('wa_admin_roles')
            ->where($condition)
            ->first();
        // 当前用的 部门 角色     创建人的 昵称 部门 角色
        return json_encode($res);
    }
}